﻿using System;
using System.Configuration;

namespace DotNetServiceAssembly.LoadAppSettings
{
    class AppSettingLoader
    {
        public static string TryToLoad(string settingName)
        {
            string appSetting;
            if (ConfigurationManager.AppSettings[settingName] != null)
                appSetting = ConfigurationManager.AppSettings[settingName].ToString();
            else
                throw new Exception(String.Format("Setting with name {0} could not be loaded.", settingName));
            return appSetting;
        }
    }
}